<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt"  %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Main</title>
</head>
<c:if test="${list eq null}">
    <script>
        location.href="/all.do";
    </script>
</c:if>
<body>
<div style="width: 1200px; text-align: center" align="center">
    <h2>常见问题检索</h2>
    <form action="${pageContext.request.contextPath}/all.do" method="post">
        <span>请输入查询关键字：</span><input type="text" id="title" name="title"/>
        <input type="submit" value="查询"/><a href="add.jsp">添加常见问题</a>
    </form>
    <c:if test="${msg != null}">
        <h2>${msg}</h2>
        <h2>${msg2}</h2>
    </c:if>
    <c:if test="${msg eq null}">
        <h2>检索结果</h2>
        <table id="new"  width="800px;"align="center"  border="1px;" style="margin-top: 25px;" bgcolor="#f0f8ff">
            <tr>
                <td>编号</td>
                <td>标题</td>
                <td>分类</td>
                <td>创建时间</td>
            </tr>
            <c:forEach items="${list}" var="v">
                <tr>
                    <td>${v.id}</td>
                    <td><a href="/info.do?id=${v.id}">${v.title}</a></td>
                    <td>${v.cname}</td>
                    <td><f:formatDate value="${v.createDate}" type="date"/></td>
                </tr>
            </c:forEach>
        </table>
    </c:if>

</div>
</body>
</html>